/**
 * 
 */
package info.niwota.home;

import info.niwota.home.fm.FileExploreActivity;
import instant.openvfs.home.Debug;
import x.java.io.File;
import android.content.Intent;
import android.os.Bundle;
import android.util.Log;

/**
 * @author qiangli
 *
 */
public class HomeTabList extends FileExploreActivity {

	private static final String TAG = "HomeTabList";
	private boolean initing = false;

	//private static AsyncTask<Void, Void, Void> bgTask;

//	private class SetBGTask extends AsyncTask<Void, Void, Void> {
//
//		@Override
//		protected Void doInBackground(Void... arg0) {
//			return null;
//		}
//
//		private void load() {
//			Drawable wallpaper = peekWallpaper();
//			if (wallpaper == null) {
//				try {
//					clearWallpaper();
//				} catch (IOException e) {
//					Log.e(TAG, "Failed to clear wallpaper " + e);
//				}
//			} else {
//				getWindow().setBackgroundDrawable(
//						new ClippedDrawable(wallpaper));
//			}
//		}
//
//		@Override
//		protected void onPostExecute(Void result) {
//			try {
//				load();
//			} catch (Exception e) {
//				// ignore
//			}
//		}
//	}

	@Override
	public void onCreate(Bundle savedInstance) {
		super.onCreate(savedInstance);
		if (Debug.DEBUG) {
			Log.d(TAG, "onCreate savedInstance: " + savedInstance);
		}
		initing = true;
		//setDefaultWallpaper();
	}

//	private void setDefaultWallpaper() {
//		if (Debug.DEBUG) {
//			Log.d(TAG, "setDefaultWallpaper");
//		}
//		if (bgTask != null) {
//			bgTask.cancel(true);
//		}
//		bgTask = new SetBGTask();
//		bgTask.execute();
//	}
	
	@Override
	public void onDestroy() {
		if (Debug.DEBUG) {
			Log.d(TAG, "onDestroy ");
		}
		super.onDestroy();
	}

	@Override
	protected void onPause() {
		initing = false;
		//
		if (Debug.DEBUG) {
			Log.d(TAG, "onPause ");
		}
		super.onPause();
	}

	@Override
	protected void onResume() {
		super.onResume();
		if (Debug.DEBUG) {
			Log.d(TAG, "onResume  init: " + initing);
		}
		//
		if (!initing) {
			File f = readPath();
			changeTo(f);
		}
	}

	@Override
	protected void onSaveInstanceState(Bundle outState) {
		super.onSaveInstanceState(outState);
		if (Debug.DEBUG) {
			Log.d(TAG, "onSaveInstanceState: " + outState);
		}
	}
	
	@Override
	protected void onNewIntent(Intent intent) {
		if (Debug.DEBUG) {
			Log.d(TAG, "onNewIntent: " + intent);
		}
		super.onNewIntent(intent);
	}

	
	@Override
	protected void onRestart() {
		super.onRestart();
		//
		if (Debug.DEBUG) {
			Log.d(TAG, "onRestart: ");
		}
	}

	@Override
	protected void onStart() {
		super.onStart();
		if (Debug.DEBUG) {
			Log.d(TAG, "onStart: ");
		}
	}

	@Override
	protected void onStop() {
		if (Debug.DEBUG) {
			Log.d(TAG, "onStop: ");
		}
		super.onStop();
	}

}
